package com.itchen.convert;

import com.itchen.emtity.dataobject.UploadDO;
import com.itchen.emtity.po.UploadPO;
import com.itchen.emtity.vo.UploadVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

@Component
public class UploadConvert {
    /**
     * VO转DO
     * @param uploadVO
     * @return
     */
    public UploadDO uploadVOToDO(UploadVO uploadVO){
        UploadDO uploadDO = new UploadDO();
        BeanUtils.copyProperties(uploadVO,uploadDO);
        return uploadDO;
    }

    /**
     * DO转VO
     * @param uploadDO
     * @return
     */
    public UploadVO uploadDOToVO(UploadDO uploadDO){
        UploadVO uploadVO = new UploadVO();
        BeanUtils.copyProperties(uploadDO,uploadVO);
        return uploadVO;
    }

    /**
     * DO转PO
     * @param uploadDO
     * @return
     */
    public UploadPO uploadDOToPO(UploadDO uploadDO){
        UploadPO uploadPO = new UploadPO();
        BeanUtils.copyProperties(uploadDO,uploadPO);
        return uploadPO;
    }

    /**
     * PO转DO
     * @param uploadPO
     * @return
     */
    public UploadDO uploadPOToDO(UploadPO uploadPO){
        UploadDO uploadDO = new UploadDO();
        BeanUtils.copyProperties(uploadPO,uploadDO);
        return uploadDO;
    }
}
